Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

is-generator

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-generator

Check whether a value is a generator or generator function

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is is-generator?

The is-generator npm package is a utility for checking if a given value is a generator function or a generator object. This can be useful in various scenarios where you need to handle generator functions or objects differently from other types of functions or objects.

What are is-generator's main functionalities?

Check if a value is a generator function

This feature allows you to check if a given function is a generator function. The `isGenerator.fn` method returns true if the input is a generator function and false otherwise.

const isGenerator = require('is-generator');

function* genFunc() {}

console.log(isGenerator.fn(genFunc)); // true
console.log(isGenerator.fn(function() {})); // false

Check if a value is a generator object

This feature allows you to check if a given value is a generator object. The main `isGenerator` method returns true if the input is a generator object and false otherwise.

const isGenerator = require('is-generator');

function* genFunc() {}
const genObj = genFunc();

console.log(isGenerator(genObj)); // true
console.log(isGenerator({})); // false

Other packages similar to is-generator

Keywords

FAQs

Package last updated on 29 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc